import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'
const MallKey = 'Admin-Mall'

export const getCookies = (key, defaultValue) =>
  Cookies.get(key) ? Cookies.get(key) : defaultValue

export const setCookies = (key, value) => Cookies.set(key, value)

export const removeCookies = (key) => Cookies.remove(key)

export const getToken = () => localStorage.getItem(TokenKey)
export const setToken = (token) => localStorage.setItem(TokenKey, token)
export const removeToken = () => localStorage.removeItem(TokenKey)

export const getMall = () => localStorage.getItem(TokenKey)
export const setMall = (token) => localStorage.setItem(TokenKey, token)
